package com.cyzy.server.dao;

import com.cyzy.pojo.entity.HuntTag;
import com.cyzy.pojo.entity.RecruitTag;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface RecruitCardTagsDao {

    /**
     * 批量插入标签
     * @param tags
     */
    void insertBatch(List<RecruitTag> tags);

    /**
     *根据id删除求职帖子里的标签
     */
    @Delete("delete from recruit_tag where recruit_card_id = #{id}")
    void deleteByRecruitCardId(Integer id);

    /**
     * 根据求职帖子的id查询标签
     */
    @Select("select * from recruit_tag where recruit_card_id = #{id}")
    List<RecruitTag> selectRecruitTagByHuntId(Integer id);

    /**
     * 根据id更新招募贴的标签
     */
    @Update("UPDATE recruit_tag SET value = #{value} WHERE recruit_card_id = #{recruitCardId}")
    void updateHuntTag(RecruitTag recruitTag);
}
